<?php

/**
 * Utilisateur form base class.
 *
 * @method Utilisateur getObject() Returns the current form's model object
 *
 * @package    jobeat
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseUtilisateurForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                   => new sfWidgetFormInputHidden(),
      'attrnom'              => new sfWidgetFormInputText(),
      'attrprenom'           => new sfWidgetFormInputText(),
      'attremail'            => new sfWidgetFormInputText(),
      'attrmdp'              => new sfWidgetFormInputText(),
      'attrdroit'            => new sfWidgetFormChoice(array('choices' => array('Utilisateur' => 'Utilisateur', 'Administrateur' => 'Administrateur'))),
      'attrupload'			 => new sfWidgetFormInputCheckbox(),
      'attrdownload'         => new sfWidgetFormInputCheckbox(),
      
      /*'attrongletmodifier' => new sfWidgetFormInputText(),
      'attrongletoutils'     => new sfWidgetFormInputText(),
      'attrongletadmin'      => new sfWidgetFormInputText(),
      'attrisfirstconnexion' => new sfWidgetFormInputText(),
      'attrcomptevalid'      => new sfWidgetFormInputText(),*/
    ));

	$this->widgetSchema->setLabels(array(
	  'attrnom'    => 'Nom',
	  'attrprenom' => 'Prenom',
	  'attremail'  => 'Email',
	  'attrmdp'    => 'Mot de passe',
	  'attrdroit'  => 'Droit',
	  'attrupload' => 'Upload',
	  'attrdownload'    => 'Download',
	));

    $this->setValidators(array(
      'id'                   => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'attrnom'              => new sfValidatorString(array('max_length' => 50)),
      'attrprenom'           => new sfValidatorString(array('max_length' => 50)),
      'attremail'            => new sfValidatorString(array('max_length' => 250)),
      'attrmdp'              => new sfValidatorString(array('max_length' => 20)),
      'attrdroit'            => new sfValidatorChoice(array('choices' => array(0 => 'Utilisateur', 1 => 'Administrateur'), 'required' => false)),
      'attrupload'           => new sfValidatorBoolean(array('required' => false)),
      'attrdownload'         => new sfValidatorBoolean(array('required' => false)),
     /* 'attrongletmodifier' => new sfValidatorInteger(array('required' => false)),
      'attrongletoutils'     => new sfValidatorInteger(array('required' => false)),
      'attrongletadmin'      => new sfValidatorInteger(array('required' => false)),
      'attrisfirstconnexion' => new sfValidatorInteger(array('required' => false)),
      'attrcomptevalid'      => new sfValidatorInteger(array('required' => false)),*/
    ));

    $this->widgetSchema->setNameFormat('utilisateur[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Utilisateur';
  }

}
